Skip to content

Conversation

@DmitryMK
Copy link
Collaborator

@DmitryMK DmitryMK commented Oct 8, 2025

Addresses #1366
It is build on top of #1365, which should be merged (or rejected) first.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Updates the application's exit code handling to return exit code 2 for error conditions instead of 0, addressing issue #1366. This ensures proper error reporting to external systems that depend on exit codes.

  • Changed application exit codes from 0 to 2 for various error conditions
  • Added exclude rules functionality with new --exclude-rules CLI option
  • Added validation to prevent simultaneous use of include and exclude rules

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
core.py Added exclude-rules CLI option and updated exit codes to 2 for error conditions
cdisc_rules_engine/models/validation_args.py Added exclude_rules field to validation args model
scripts/script_utils.py Enhanced rule loading functions to support exclude rules and updated error handling
tests/unit/test_script_utils.py Added comprehensive tests for new exclude rules functionality
tests/unit/test_services/test_data_service/test_data_service.py Updated test data to include additional None parameter
tests/QARegressionTests/test_core/test_validate.py Added tests for exclude rules and updated expected exit codes
README.md Updated documentation to include new exclude-rules option

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@DmitryMK
Copy link
Collaborator Author

Reverted the change introduced by #1351 for the -vx flag (--validate-xml).

@RamilCDISC
Copy link
Collaborator

Could you please resolve the conflicts on this ticket ? and then we are good to merge.

@DmitryMK
Copy link
Collaborator Author

Could you please resolve the conflicts on this ticket ? and then we are good to merge.

Ramil, the conflict is resolved now.

@RamilCDISC
Copy link
Collaborator

There is another conflict. Could you please look into that one too?

@DmitryMK
Copy link
Collaborator Author

There is another conflict. Could you please look into that one too?

Updated

@DmitryMK
Copy link
Collaborator Author

DmitryMK commented Oct 14, 2025

@gerrycampion I'm getting an error with the test_jsonata_processor.py in this branch.

I've tested it in the main branch and the same error is happening there, so it looks like it is not connected with this branch, but rather something is wrong in the main branch. Could you please help to look into it, as I understand you added this test.

Looks like in execute_jsonata_rule in this line:

   error_entity = ValidationErrorEntity(
                    value=result,
                    dataset=result.get("dataset") or "",
                    row=result.get("row"),
                    usubjid=result.get("USUBJID"),
                    sequence=result.get("SEQ"),
                )

USUBJID and SEQ are expected and usubjid/sequence are passed. This difference was introduced by #1376 PR.

@gerrycampion
Copy link
Collaborator

@DmitryMK PR is here: #1377
@RamilCDISC to avoid this type of problem in the future, we should always "Update Branch" (even if there are no merge conflicts) and wait for the tests to rerun before doing a merge. I wish we could enforce this in GH, but maybe an alternative option is to rerun our tests after a merge to main. I will make a ticket for this.

Copy link
Collaborator

@RamilCDISC RamilCDISC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR updates the exit code so an exit code 2 is returned for errors instead of 0. The PR was validated by:

  1. Verifying the updated code.
  2. Ensuring all relevant error messages are updated.
  3. Ensuring the relevant testing is updated.
  4. Ensuring all unit tests and other testing pass.
  5. Ensuing the manual testing pass.

@RamilCDISC RamilCDISC merged commit 49332be into main Oct 14, 2025
6 checks passed
@RamilCDISC RamilCDISC deleted the 1366-update-exit-code branch October 14, 2025 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants